#include <stdio.h>
int majorityElement(int* nums, int numsSize) 
{
    int i;
    int most = nums[0];
    unsigned int j = 1;
    for(i = 1; i < numsSize; i++)
    {
        if(nums[i] == most)
            j++;
        else
        {
            if(j == 0)
            {
                most = nums[i];
                j++;
            }
            else
            {
                j--;
            }
        }
    }
    return most;
}
